{extend name="public/base" /}
{block name="container"}
<div class="panel panel-default">
  <div class="panel-heading">
    <h4 class="panel-title">会员卡补办</h4>
  </div>
  <div class="panel-body panel-body-nopadding">

    <form class="form-horizontal form-bordered" id="submitForm" action="" method="post" >
      <div class="form-group">
        <label class="col-sm-3 control-label">旧卡号:</label>
        <div class="col-sm-6">
          <input type="text" class="form-control" name="card_num" id="card_num" placeholder="请输入卡号"  value=""  required >
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-3 control-label"><span>*</span>手机号：</label>
        <div class="col-sm-6">
          <input type="text" class="form-control" placeholder="手机号" id="phone" name="phone" value=""  required>
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-3 control-label"><span>*</span>身份证号码：</label>
        <div class="col-sm-6">
          <input type="text" class="form-control" placeholder="身份证号码" name="id_number" id="id_number" value="" required>
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-3 control-label"><span>*</span>新卡号：</label>
        <div class="col-sm-6">
          <input class="form-control" type="text" name="new_num" id="money" placeholder="请输入金额" datatype="*" value="" required >
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-3 control-label">密码:</label>
        <div class="col-sm-6">
          <input type="password" class="form-control" name="password" datatype="*" placeholder="请输入密码" required value="" >
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-3 control-label">确认密码:</label>
        <div class="col-sm-6">
          <input type="password" class="form-control" name="md5_pas" datatype="*" placeholder="请输入确认密码" required value="" >
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-3 control-label">状态：</label>
        <div class="col-sm-6 wh-inline">
          <div class="rdio rdio-primary">
            <input type="radio" name="status" id="status-1" value="1">正常
            <input type="radio" name="status" id="status-2" value="0">冻结
          </div>
        </div>
      </div>
      <div class="panel-footer">
       <div class="row">
        <div class="col-sm-6 col-sm-offset-3">
          <input type="hidden" name="id" value="{$data.id ?? ''}">
          <button type="submit" class="btn btn-primary">提交</button>
          <button type="button" class="btn btn-default" onclick="javascript:history.back(-1);">返回</button>
        </div>
      </div>
    </div><!-- panel-footer -->

  </form>
</div>
{/block}
{block name="js"}
<script>
  $(function() {
    $("[name='status'][value='{$data.status ?? '1'}']").attr("checked", true);
    $("[name='sex'][value='{$data.sex ?? '1'}']").attr("checked", true);
    $('#id_number').change(function() {
      var card_num  = $('#card_num').val();
      var phone     = $('#phone').val();
      var id_number = $('#id_number').val();
      $.post('{:url("index/member/checkCardInfo")}', {card_num: card_num, phone: phone, id_number: id_number}, function(data) {
        if(data.sta == 1){
          swal({title: '信息正确',text: "",type: "success"});
        }else{
          swal({title: '信息核对失败',text: "",type: "error"});
        }
      });
    });
  });
</script>
{/block}